Hệ thống xếp lịch học tín chỉ cho sinh viên CNTT trên PHP & MySQL
112.155 lượt xem;
1 <?php
2 $currDir = dirname(__FILE__);
3 require("{$currDir}/incCommon.php");
4 $GLOBALS['page_title'] = $Translation['membership management homepage'];
5 include("{$currDir}/incHeader.php");
6 ?>
7
8 <?php
9 if(!sqlValue("select count(1) from membership_groups where allowSignup=1")){
10 $noSignup=TRUE;
11 ?>
12 <div class="alert alert-info">
13 <i><?php echo $Translation["attention"]; ?></i>
14 <br><?php echo $Translation["visitor sign up"]; ?>
15 </div>
16 <?php
17 }
18 ?>
19
20 <?php
21 // get the count of records having no owners in each table
22 $arrTables=getTableList();
23
24 foreach($arrTables as $tn=>$tc){
25 $countOwned=sqlValue("select count(1) from membership_userrecords where tableName='$tn' and not isnull(groupID)");
26 $countAll=sqlValue("select count(1) from `$tn`");
27
28 if($countAll>$countOwned){
29 ?>
30 <div class="alert alert-info">
31 <?php echo $Translation["table data without owner"]; ?>
32 </div>
33 <?php
34 break;
35 }
36 }
37 ?>
38
39 <div class="page-header"><h1><?php echo $Translation['membership management homepage']; ?></h1></div>
40
41 <?php if(!$adminConfig['hide_twitter_feed']){ ?>
42 <div class="row" id="outer-row"><div class="col-md-8">
43 <?php } ?>
44
45 <div class="row" id="inner-row">
46
47 <!-- ################# Maintenance mode ###################### -->
48 <?php
49 if(maintenance_mode()){
50 $off_classes = 'btn-default locked_inactive';
51 $on_classes = 'btn-danger unlocked_active';
52 }else{
53 $off_classes = 'btn-success locked_active';
54 $on_classes = 'btn-default unlocked_inactive';
55 }
56 ?>
57 <div class="col-md-12 text-right vspacer-lg">
58 <label><?php echo $Translation['maintenance mode']; ?></label>
59 <div class="btn-group" id="toggle_maintenance_mode">
60 <button type="button" class="btn <?php echo $off_classes; ?>"><?php echo $Translation['OFF']; ?></button>
61 <button type="button" class="btn <?php echo $on_classes; ?>"><?php echo $Translation['ON']; ?></button>
62 </div>
63 </div>
64 <script>
65 $j('#toggle_maintenance_mode button').click(function(){
66 if($j(this).hasClass('locked_active') || $j(this).hasClass('unlocked_inactive')){
67 if(confirm('<?php echo html_attr($Translation['enable maintenance mode?']); ?>')){
68 $j.ajax({
69 url: 'ajax-maintenance-mode.php?status=on',
70 complete: function(){
71 location.reload();
72 }
73 });
74 }
75 }else{
76 if(confirm('<?php echo html_attr($Translation['disable maintenance mode?']); ?>')){
77 $j.ajax({
78 url: 'ajax-maintenance-mode.php?status=off',
79 complete: function(){
80 location.reload();
81 }
82 });
83 }
84 }
85 });
86 </script>
87
88 <!-- ################# Newest Updates ######################## -->
89 <div class="col-md-6">
90 <div class="panel panel-info">
91 <div class="panel-heading">
92 <h3 class="panel-title"><?php echo $Translation["newest updates"]; ?> <a class="btn btn-default btn-sm" href="pageViewRecords.php?sort=dateUpdated&sortDir=desc"><i class="glyphicon glyphicon-chevron-right"></i></a></h3>
93 </div>
94 <div class="panel-body">
95 <table class="table table-striped table-hover">
96 <?php
97 $res=sql("select tableName, pkValue, dateUpdated, recID from membership_userrecords order by dateUpdated desc limit 5", $eo);
98 while($row=db_fetch_row($res)){
99 ?>
100 <tr>
101 <th style="min-width: 13em;"><?php echo @date($adminConfig['PHPDateTimeFormat'], $row[2]); ?></th>
102 <td class="remaining-width"><div class="clipped"><a href="pageEditOwnership.php?recID=<?php echo $row[3]; ?>"><img src="images/data_icon.gif" border="0" alt="<?php echo $Translation["view record details"]; ?>" title="<?php echo $Translation["view record details"]; ?>"></a> <?php echo getCSVData($row[0], $row[1]); ?></div></td>
103 </tr>
104 <?php
105 }
106 ?>
107 </table>
108 </div>
109 </div>
110 </div>
111 <!-- ####################################################### -->
112
113
114 <!-- ################# Newest Entries ######################## -->
115 <div class="col-md-6">
116 <div class="panel panel-info">
117 <div class="panel-heading">
118 <h3 class="panel-title"><?php echo $Translation["newest entries"]; ?> <a class="btn btn-default btn-sm" href="pageViewRecords.php?sort=dateAdded&sortDir=desc"><i class="glyphicon glyphicon-chevron-right"></i></a></h3>
119 </div>
120 <div class="panel-body">
121 <table class="table table-striped table-hover">
122 <?php
123 $res=sql("select tableName, pkValue, dateAdded, recID from membership_userrecords order by dateAdded desc limit 5", $eo);
124 while($row=db_fetch_row($res)){
125 ?>
126 <tr>
127 <th style="min-width: 13em;"><?php echo @date($adminConfig['PHPDateTimeFormat'], $row[2]); ?></th>
128 <td class="remaining-width"><div class="clipped"><a href="pageEditOwnership.php?recID=<?php echo $row[3]; ?>"><img src="images/data_icon.gif" border="0" alt="<?php echo $Translation["view record details"]; ?>" title="<?php echo $Translation["view record details"]; ?>"></a> <?php echo getCSVData($row[0], $row[1]); ?></div></td>
129 </tr>
130 <?php
131 }
132 ?>
133 </table>
134 </div>
135 </div>
136 </div>
137 <!-- ####################################################### -->
138
139
140
141
142 <!-- ################# Top Members ######################## -->
143 <div class="col-md-6">
144 <div class="panel panel-info">
145 <div class="panel-heading">
146 <h3 class="panel-title"><?php echo $Translation["top members"]; ?></h3>
147 </div>
148 <div class="panel-body">
149 <table class="table table-striped table-hover">
150 <?php
151 $res=sql("select lcase(memberID), count(1) from membership_userrecords group by memberID order by 2 desc limit 5", $eo);
152 while($row=db_fetch_row($res)){
153 ?>
154 <tr>
155 <th class="" style="max-width: 10em;"><a href="pageEditMember.php?memberID=<?php echo urlencode($row[0]); ?>" title="<?php echo $Translation["edit member details"]; ?>"><i class="glyphicon glyphicon-pencil"></i> <?php echo $row[0]; ?></a></th>
156 <td class="remaining-width"><a href="pageViewRecords.php?memberID=<?php echo urlencode($row[0]); ?>"><img src="images/data_icon.gif" border="0" alt="<?php echo $Translation["view member records"]; ?>" title="<?php echo $Translation["view member records"]; ?>"></a> <?php echo $row[1]; ?> <?php echo $Translation["records"]; ?></td>
157 </tr>
158 <?php
159 }
160 ?>
161 </table>
162 </div>
163 </div>
164 </div>
165 <!-- ####################################################### -->
166
167
168 <!-- ################# Members Stats ######################## -->
169 <div class="col-md-6">
170 <div class="panel panel-info">
171 <div class="panel-heading">
172 <h3 class="panel-title"><?php echo $Translation["members stats"]; ?></h3>
173 </div>
174 <div class="panel-body">
175 <table class="table table-striped table-hover">
176 <tr>
177 <th class=""><?php echo $Translation["total groups"]; ?></th>
178 <td class="remaining-width"><a href="pageViewGroups.php"title="<?php echo $Translation['view groups']; ?>"><i class="glyphicon glyphicon-search"></i> <?php echo sqlValue("select count(1) from membership_groups"); ?></a></td>
179 </tr>
180 <tr>
181 <th class=""><?php echo $Translation["active members"]; ?></th>
182 <td class="remaining-width"><a href="pageViewMembers.php?status=2" title="<?php echo $Translation["view active members"]; ?>"><i class="glyphicon glyphicon-search"></i> <?php echo sqlValue("select count(1) from membership_users where isApproved=1 and isBanned=0"); ?></a></td>
183 </tr>
184 <tr>
185 <?php
186 $awaiting = intval(sqlValue("select count(1) from membership_users where isApproved=0"));
187 ?>
188 <th class="" <?php echo ($awaiting ? "style=\"color: red;\"" : ""); ?>><?php echo $Translation["members awaiting approval"]; ?></th>
189 <td class="remaining-width"><a href="pageViewMembers.php?status=1" title="<?php echo $Translation["view members awaiting approval"]; ?>"><i class="glyphicon glyphicon-search"></i> <?php echo $awaiting; ?></a></td>
190 </tr>
191 <tr>
192 <th class=""><?php echo $Translation["banned members"]; ?></th>
193 <td class="remaining-width"><a href="pageViewMembers.php?status=3" title="<?php echo $Translation["view banned members"]; ?>"><i class="glyphicon glyphicon-search"></i> <?php echo sqlValue("select count(1) from membership_users where isApproved=1 and isBanned=1"); ?></a></td>
194 </tr>
195 <tr>
196 <th class=""><?php echo $Translation["total members"]; ?></th>
197 <td class="remaining-width"><a href="pageViewMembers.php" title="<?php echo $Translation["view all members"]; ?>"><i class="glyphicon glyphicon-search"></i> <?php echo sqlValue("select count(1) from membership_users"); ?></a></td>
198 </tr>
199 </table>
200 </div>
201 </div>
202 </div>
203 <!-- ####################################################### -->
204
205 </div> <!-- /div.row#inner-row -->
206
207 <?php if(!$adminConfig['hide_twitter_feed']){ ?>
208 </div> <!-- /div.col-md-8 -->
209
210 <div class="col-md-4" id="twitter-feed">
211 <h3>
212 <?php echo $Translation["BigProf tweets"]; ?>
213 <span class="pull-right">
214 <a class="twitter-follow-button" href="https://twitter.com/bigprof" data-show-count="false" data-lang="en"><?php echo $Translation["follow BigProf"]; ?></a>
215 <script type="text/javascript">
216 window.twttr = (function (d, s, id) {
217 var t, js, fjs = d.getElementsByTagName(s)[0];
218 if (d.getElementById(id)) return;
219 js = d.createElement(s); js.id = id;
220 js.src= "https://platform.twitter.com/widgets.js";
221 fjs.parentNode.insertBefore(js, fjs);
222 return window.twttr || (t = { _e: [], ready: function (f) { t._e.push(f) } });
223 }(document, "script", "twitter-wjs"));
224 </script>
225 </span>
226 </h3><hr>
227 <div class="text-center">
228 <a class="twitter-timeline" height="400" href="https://twitter.com/bigprof" data-widget-id="552758720300843008" data-chrome="nofooter noheader"><?php echo $Translation["loading bigprof feed"]; ?></a>
229 <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
230 </div>
231 <div class="text-right hidden" id="remove-feed-link"><a href="pageSettings.php#hide_twitter_feed"><i class="glyphicon glyphicon-remove"></i> <?php echo $Translation["remove feed"]; ?></a></div>
232 <script>
233 $j(function(){
234 show_remove_feed_link = function(){
235 if(!$j('.twitter-timeline-rendered').length){
236 setTimeout(function(){ /* */ show_remove_feed_link(); }, 1000);
237 }else{
238 $j('#remove-feed-link').removeClass('hidden');
239 }
240 };
241 show_remove_feed_link();
242 });
243 </script>
244 </div>
245 </div> <!-- /div.row#outer-row -->
246 <?php } ?>
247
248 <script>
249 $j(function(){
250 $j(window).resize(function(){
251 $j('.remaining-width').each(function(){
252 var panel_width = $j(this).parents('.panel-body').width();
253 var other_cell_width = $j(this).prev().width();
254
255 $j(this).attr('style', 'max-width: ' + (panel_width * .9 - other_cell_width) + 'px !important;');
256 });
257 }).resize();
258 })
259 </script>
260
261
262 <?php
263 include("{$currDir}/incFooter.php");
264 ?>
2 $currDir = dirname(__FILE__);
3 require("{$currDir}/incCommon.php");
4 $GLOBALS['page_title'] = $Translation['membership management homepage'];
5 include("{$currDir}/incHeader.php");
6 ?>
7
8 <?php
9 if(!sqlValue("select count(1) from membership_groups where allowSignup=1")){
10 $noSignup=TRUE;
11 ?>
12 <div class="alert alert-info">
13 <i><?php echo $Translation["attention"]; ?></i>
14 <br><?php echo $Translation["visitor sign up"]; ?>
15 </div>
16 <?php
17 }
18 ?>
19
20 <?php
21 // get the count of records having no owners in each table
22 $arrTables=getTableList();
23
24 foreach($arrTables as $tn=>$tc){
25 $countOwned=sqlValue("select count(1) from membership_userrecords where tableName='$tn' and not isnull(groupID)");
26 $countAll=sqlValue("select count(1) from `$tn`");
27
28 if($countAll>$countOwned){
29 ?>
30 <div class="alert alert-info">
31 <?php echo $Translation["table data without owner"]; ?>
32 </div>
33 <?php
34 break;
35 }
36 }
37 ?>
38
39 <div class="page-header"><h1><?php echo $Translation['membership management homepage']; ?></h1></div>
40
41 <?php if(!$adminConfig['hide_twitter_feed']){ ?>
42 <div class="row" id="outer-row"><div class="col-md-8">
43 <?php } ?>
44
45 <div class="row" id="inner-row">
46
47 <!-- ################# Maintenance mode ###################### -->
48 <?php
49 if(maintenance_mode()){
50 $off_classes = 'btn-default locked_inactive';
51 $on_classes = 'btn-danger unlocked_active';
52 }else{
53 $off_classes = 'btn-success locked_active';
54 $on_classes = 'btn-default unlocked_inactive';
55 }
56 ?>
57 <div class="col-md-12 text-right vspacer-lg">
58 <label><?php echo $Translation['maintenance mode']; ?></label>
59 <div class="btn-group" id="toggle_maintenance_mode">
60 <button type="button" class="btn <?php echo $off_classes; ?>"><?php echo $Translation['OFF']; ?></button>
61 <button type="button" class="btn <?php echo $on_classes; ?>"><?php echo $Translation['ON']; ?></button>
62 </div>
63 </div>
64 <script>
65 $j('#toggle_maintenance_mode button').click(function(){
66 if($j(this).hasClass('locked_active') || $j(this).hasClass('unlocked_inactive')){
67 if(confirm('<?php echo html_attr($Translation['enable maintenance mode?']); ?>')){
68 $j.ajax({
69 url: 'ajax-maintenance-mode.php?status=on',
70 complete: function(){
71 location.reload();
72 }
73 });
74 }
75 }else{
76 if(confirm('<?php echo html_attr($Translation['disable maintenance mode?']); ?>')){
77 $j.ajax({
78 url: 'ajax-maintenance-mode.php?status=off',
79 complete: function(){
80 location.reload();
81 }
82 });
83 }
84 }
85 });
86 </script>
87
88 <!-- ################# Newest Updates ######################## -->
89 <div class="col-md-6">
90 <div class="panel panel-info">
91 <div class="panel-heading">
92 <h3 class="panel-title"><?php echo $Translation["newest updates"]; ?> <a class="btn btn-default btn-sm" href="pageViewRecords.php?sort=dateUpdated&sortDir=desc"><i class="glyphicon glyphicon-chevron-right"></i></a></h3>
93 </div>
94 <div class="panel-body">
95 <table class="table table-striped table-hover">
96 <?php
97 $res=sql("select tableName, pkValue, dateUpdated, recID from membership_userrecords order by dateUpdated desc limit 5", $eo);
98 while($row=db_fetch_row($res)){
99 ?>
100 <tr>
101 <th style="min-width: 13em;"><?php echo @date($adminConfig['PHPDateTimeFormat'], $row[2]); ?></th>
102 <td class="remaining-width"><div class="clipped"><a href="pageEditOwnership.php?recID=<?php echo $row[3]; ?>"><img src="images/data_icon.gif" border="0" alt="<?php echo $Translation["view record details"]; ?>" title="<?php echo $Translation["view record details"]; ?>"></a> <?php echo getCSVData($row[0], $row[1]); ?></div></td>
103 </tr>
104 <?php
105 }
106 ?>
107 </table>
108 </div>
109 </div>
110 </div>
111 <!-- ####################################################### -->
112
113
114 <!-- ################# Newest Entries ######################## -->
115 <div class="col-md-6">
116 <div class="panel panel-info">
117 <div class="panel-heading">
118 <h3 class="panel-title"><?php echo $Translation["newest entries"]; ?> <a class="btn btn-default btn-sm" href="pageViewRecords.php?sort=dateAdded&sortDir=desc"><i class="glyphicon glyphicon-chevron-right"></i></a></h3>
119 </div>
120 <div class="panel-body">
121 <table class="table table-striped table-hover">
122 <?php
123 $res=sql("select tableName, pkValue, dateAdded, recID from membership_userrecords order by dateAdded desc limit 5", $eo);
124 while($row=db_fetch_row($res)){
125 ?>
126 <tr>
127 <th style="min-width: 13em;"><?php echo @date($adminConfig['PHPDateTimeFormat'], $row[2]); ?></th>
128 <td class="remaining-width"><div class="clipped"><a href="pageEditOwnership.php?recID=<?php echo $row[3]; ?>"><img src="images/data_icon.gif" border="0" alt="<?php echo $Translation["view record details"]; ?>" title="<?php echo $Translation["view record details"]; ?>"></a> <?php echo getCSVData($row[0], $row[1]); ?></div></td>
129 </tr>
130 <?php
131 }
132 ?>
133 </table>
134 </div>
135 </div>
136 </div>
137 <!-- ####################################################### -->
138
139
140
141
142 <!-- ################# Top Members ######################## -->
143 <div class="col-md-6">
144 <div class="panel panel-info">
145 <div class="panel-heading">
146 <h3 class="panel-title"><?php echo $Translation["top members"]; ?></h3>
147 </div>
148 <div class="panel-body">
149 <table class="table table-striped table-hover">
150 <?php
151 $res=sql("select lcase(memberID), count(1) from membership_userrecords group by memberID order by 2 desc limit 5", $eo);
152 while($row=db_fetch_row($res)){
153 ?>
154 <tr>
155 <th class="" style="max-width: 10em;"><a href="pageEditMember.php?memberID=<?php echo urlencode($row[0]); ?>" title="<?php echo $Translation["edit member details"]; ?>"><i class="glyphicon glyphicon-pencil"></i> <?php echo $row[0]; ?></a></th>
156 <td class="remaining-width"><a href="pageViewRecords.php?memberID=<?php echo urlencode($row[0]); ?>"><img src="images/data_icon.gif" border="0" alt="<?php echo $Translation["view member records"]; ?>" title="<?php echo $Translation["view member records"]; ?>"></a> <?php echo $row[1]; ?> <?php echo $Translation["records"]; ?></td>
157 </tr>
158 <?php
159 }
160 ?>
161 </table>
162 </div>
163 </div>
164 </div>
165 <!-- ####################################################### -->
166
167
168 <!-- ################# Members Stats ######################## -->
169 <div class="col-md-6">
170 <div class="panel panel-info">
171 <div class="panel-heading">
172 <h3 class="panel-title"><?php echo $Translation["members stats"]; ?></h3>
173 </div>
174 <div class="panel-body">
175 <table class="table table-striped table-hover">
176 <tr>
177 <th class=""><?php echo $Translation["total groups"]; ?></th>
178 <td class="remaining-width"><a href="pageViewGroups.php"title="<?php echo $Translation['view groups']; ?>"><i class="glyphicon glyphicon-search"></i> <?php echo sqlValue("select count(1) from membership_groups"); ?></a></td>
179 </tr>
180 <tr>
181 <th class=""><?php echo $Translation["active members"]; ?></th>
182 <td class="remaining-width"><a href="pageViewMembers.php?status=2" title="<?php echo $Translation["view active members"]; ?>"><i class="glyphicon glyphicon-search"></i> <?php echo sqlValue("select count(1) from membership_users where isApproved=1 and isBanned=0"); ?></a></td>
183 </tr>
184 <tr>
185 <?php
186 $awaiting = intval(sqlValue("select count(1) from membership_users where isApproved=0"));
187 ?>
188 <th class="" <?php echo ($awaiting ? "style=\"color: red;\"" : ""); ?>><?php echo $Translation["members awaiting approval"]; ?></th>
189 <td class="remaining-width"><a href="pageViewMembers.php?status=1" title="<?php echo $Translation["view members awaiting approval"]; ?>"><i class="glyphicon glyphicon-search"></i> <?php echo $awaiting; ?></a></td>
190 </tr>
191 <tr>
192 <th class=""><?php echo $Translation["banned members"]; ?></th>
193 <td class="remaining-width"><a href="pageViewMembers.php?status=3" title="<?php echo $Translation["view banned members"]; ?>"><i class="glyphicon glyphicon-search"></i> <?php echo sqlValue("select count(1) from membership_users where isApproved=1 and isBanned=1"); ?></a></td>
194 </tr>
195 <tr>
196 <th class=""><?php echo $Translation["total members"]; ?></th>
197 <td class="remaining-width"><a href="pageViewMembers.php" title="<?php echo $Translation["view all members"]; ?>"><i class="glyphicon glyphicon-search"></i> <?php echo sqlValue("select count(1) from membership_users"); ?></a></td>
198 </tr>
199 </table>
200 </div>
201 </div>
202 </div>
203 <!-- ####################################################### -->
204
205 </div> <!-- /div.row#inner-row -->
206
207 <?php if(!$adminConfig['hide_twitter_feed']){ ?>
208 </div> <!-- /div.col-md-8 -->
209
210 <div class="col-md-4" id="twitter-feed">
211 <h3>
212 <?php echo $Translation["BigProf tweets"]; ?>
213 <span class="pull-right">
214 <a class="twitter-follow-button" href="https://twitter.com/bigprof" data-show-count="false" data-lang="en"><?php echo $Translation["follow BigProf"]; ?></a>
215 <script type="text/javascript">
216 window.twttr = (function (d, s, id) {
217 var t, js, fjs = d.getElementsByTagName(s)[0];
218 if (d.getElementById(id)) return;
219 js = d.createElement(s); js.id = id;
220 js.src= "https://platform.twitter.com/widgets.js";
221 fjs.parentNode.insertBefore(js, fjs);
222 return window.twttr || (t = { _e: [], ready: function (f) { t._e.push(f) } });
223 }(document, "script", "twitter-wjs"));
224 </script>
225 </span>
226 </h3><hr>
227 <div class="text-center">
228 <a class="twitter-timeline" height="400" href="https://twitter.com/bigprof" data-widget-id="552758720300843008" data-chrome="nofooter noheader"><?php echo $Translation["loading bigprof feed"]; ?></a>
229 <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
230 </div>
231 <div class="text-right hidden" id="remove-feed-link"><a href="pageSettings.php#hide_twitter_feed"><i class="glyphicon glyphicon-remove"></i> <?php echo $Translation["remove feed"]; ?></a></div>
232 <script>
233 $j(function(){
234 show_remove_feed_link = function(){
235 if(!$j('.twitter-timeline-rendered').length){
236 setTimeout(function(){ /* */ show_remove_feed_link(); }, 1000);
237 }else{
238 $j('#remove-feed-link').removeClass('hidden');
239 }
240 };
241 show_remove_feed_link();
242 });
243 </script>
244 </div>
245 </div> <!-- /div.row#outer-row -->
246 <?php } ?>
247
248 <script>
249 $j(function(){
250 $j(window).resize(function(){
251 $j('.remaining-width').each(function(){
252 var panel_width = $j(this).parents('.panel-body').width();
253 var other_cell_width = $j(this).prev().width();
254
255 $j(this).attr('style', 'max-width: ' + (panel_width * .9 - other_cell_width) + 'px !important;');
256 });
257 }).resize();
258 })
259 </script>
260
261
262 <?php
263 include("{$currDir}/incFooter.php");
264 ?>